﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Drawing;

namespace FlyBird
{
    class GameBackGround
    {
        //背景图片需要的资源图
        private Image bkimg;

        //构造器
        public GameBackGround()
        {
            bkimg = GameUtil.loadBufferedImage(StaticValue.BK_IMG_PATH);
        }
        //绘制图片
        public void draw(Graphics g)
        {

            //填充背景色
            SolidBrush brush = new SolidBrush(StaticValue.BK_COLOR);
            g.FillRectangle(brush, 0, 0, StaticValue.FRAM_WIDTH, StaticValue.FRAM_HEIGHT);
            brush = new SolidBrush(Color.Black);

            int height = bkimg.Height;
            int width = bkimg.Width;
            //循环次数
            int count = StaticValue.FRAM_WIDTH / width + 1;
            for (int i = 0; i < count; i++)
            {
                g.DrawImage(bkimg, width * i, StaticValue.FRAM_HEIGHT - height);
            }
        }
    }
}
